
    <div id="content3">
        <div class="content3_box">
            <div class="<?php echo  1 >= count($result) ?  'hide1' : 'slider-paga1' ?>" >
                <a href="javascript:;;" class="slider-pre1"><img src="__PUBLIC__/home/images/icon_fy_l.png"/></a>
                <a href="javascript:;;" class="slider-next1"><img src="__PUBLIC__/home/images/icon_fy_r.png"/></a>
            </div>
            <div class="<?php echo  1 >= count($result) ?  'slider1 slider2 ' : 'slider1 ' ?>">
                <img class="icon_delete3 close" id="clear" data-name="decision" onclick="closePopup()" src="__PUBLIC__/home/images/icon_delete1.png"/>
                <ul class="slider-main1">
                    <?php foreach($result as $k=>$v){?>
                    <li class=" <?php echo  1 >= count($result) ?  'slider-panel2' : 'slider-panel1' ?>">
                        <a href="<?php echo $v['link_address']?>" target="_blank"> <img class="img_pic5" src="/uploads/advert/<?php echo $v['image']?>"/></a>
                    </li>
                    <?php } ?>

                </ul>

                <div class="<?php echo  1 >= count($result) ?  'hide1' : 'slider-extra1' ?>">
                    <ul class="slider-nav1">
                        <?php foreach($result as $v){?>
                        <li class="slider-item1"></li>
                        <?php } ?>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <script>
        //轮播 决策利器
        $(function () {
            var length,
                    currentIndex = 0,
                    interval,
                    hasStarted =false,
                    t =3000;
            length =$('.slider-panel1').length;
            if(length==1){
                $(".slider-panel1").eq(0).show();
                return false;
            }
            $('.slider-panel1:not(:first)').hide();
            $('.slider-item1:first').addClass('slider-item-selected1');
            $('.slider-page11').hide();
            $('.slider-panel1, .slider-pre1, .slider-next1').hover(function() {
                stop();
                $('.slider-page1').show();
            }, function() {
                $('.slider-page1').hide();
                start();
            });
            $('.slider-item1').hover(function(e){
                stop();
                var preIndex = $(".slider-item1").filter(".slider-item-selected1").index();
                currentIndex = $(this).index();
                play(preIndex, currentIndex);
            }, function(){
                start();
            });
            $('.slider-pre1').unbind('click');
            $('.slider-pre1').bind('click', function() {
                pre();
            });
            $('.slider-next1').unbind('click');
            $('.slider-next1').bind('click', function() {
                next();
            });

            /**
             * 向前翻页
             */
            function pre() {
                var preIndex = currentIndex;
                currentIndex = (--currentIndex + length) % length;
                play(preIndex, currentIndex);
            }
            /**
             * 向后翻页
             */
            function next() {
                var preIndex = currentIndex;
                currentIndex = ++currentIndex % length;
                play(preIndex, currentIndex);
            }
            /**
             * 从preIndex页翻到currentIndex页
             * preIndex 整数，翻页的起始页
             * currentIndex 整数，翻到的那页
             */
            function play(preIndex, currentIndex) {
                $('.slider-panel1').eq(preIndex).fadeOut(0).parent().children().eq(currentIndex).fadeIn(0);
                $('.slider-item1').removeClass('slider-item-selected1');
                $('.slider-item1').eq(currentIndex).addClass('slider-item-selected1');
                start();
            }
            /**
             * 开始轮播
             */
            function start() {
                if(!hasStarted) {
                    hasStarted = true;
                    interval = setInterval(next, t);
                }
            }
            /**
             * 停止轮播
             */
            function stop() {
                clearInterval(interval);
                hasStarted = false;
            }
            //开始轮播
            start();
            $("#clear").click(function () {
                stop();
            });
        })
    </script>
